package com.wss.lsl.acm.p2000;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	/**
	 * @param args
	 * @throws IOException
	 * @throws NumberFormatException
	 */
	public static void main(String[] args) throws NumberFormatException,
			IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		List<Integer> input = new ArrayList<Integer>();
		while (true) {
			int days = Integer.parseInt(br.readLine());
			if (days == 0) {
				break;
			}
			input.add(days);
		}
		for (Integer days : input) {
			System.out.println(days + " " + calc(days));
		}
	}

	public static int calc(int days) {

		int index = 0;
		int count = 1;
		int indexSum = 0;
		for (int i = 1; i <= days; i++) {
			indexSum += i;
			index++;
			if (indexSum > days) {
				break;
			}
		}
		count = index * (index + 1) / 2 - days;
		return index * (index + 1) * (2 * index + 1) / 6 - index * count;
	}
}
